<%@ include file="/WEB-INF/jsp/common/include.jsp" %>
<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="search" uri="SearchTags" %>
<%@ page import="com.google.appengine.api.users.*" %>
<hr class="user-review-separator">
<c:set var="agentUserReviewCount" value="${flatAd.agentUserReviewCount}"/>
<c:set var="badPhoneUserReviewCount" value="${flatAd.badPhoneUserReviewCount}"/>
<c:set var="expiredAdUserReviewCount" value="${flatAd.expiredAdUserReviewCount}"/>
<c:if test="${(not empty agentUserReviewCount and agentUserReviewCount gt 0)
              or (not empty badPhoneUserReviewCount and badPhoneUserReviewCount gt 0)
              or (not empty expiredAdUserReviewCount and expiredAdUserReviewCount gt 0)}">
  <h3>Отзывы:</h3>
  <p>
  <c:import url="/WEB-INF/jsp/ad/search/review/reviewCount.jsp">
    <c:param name="reviewCount" value="${agentUserReviewCount}"/>
    <c:param name="reviewMessage" value="это агент"/>
  </c:import>
  <c:import url="/WEB-INF/jsp/ad/search/review/reviewCount.jsp">
    <c:param name="reviewCount" value="${badPhoneUserReviewCount}"/>
    <c:param name="reviewMessage" value="телефон неправильный"/>
  </c:import>
  <c:import url="/WEB-INF/jsp/ad/search/review/reviewCount.jsp">
    <c:param name="reviewCount" value="${expiredAdUserReviewCount}"/>
    <c:param name="reviewMessage" value="это объявление неактуально"/>
  </c:import>
  </p>
</c:if>
<search:userReview reviewers="${flatAd.reviewers}">
  <p>
    <a href="javascript:void(0)" onclick="toggleReviewButtons(<c:out value="${flatAd.id}"/>)">Пожаловаться</a> (добавить отзыв):
    <br>
    <span id="reviewButtons<c:out value='${flatAd.id}'/>" class="reviewButtons">
      <c:if test="${not flatAd.agent}">
        <a href="javascript:void(0)" class="psevdo"
          onclick="return addAgentUserReview(<c:out value='${flatAd.id}'/>, '<search:loginAndReviewUrl flatAdId='${flatAd.id}' reviewUrl="/ad/user/review/agent.do"/>');">это агент</a>
        <img id="processingAgentUserRating<c:out value='${flatAd.id}'/>" class="processing" src="/image/processing.gif">,
      </c:if>
      <a href="javascript:void(0)" class="psevdo"
         onclick="return addBadPhoneUserReview(<c:out value='${flatAd.id}'/>, '<search:loginAndReviewUrl flatAdId='${flatAd.id}' reviewUrl="/ad/user/review/badPhone.do"/>');">неправильный телефон</a>
      <img id="processingBadPhoneUserRating<c:out value='${flatAd.id}'/>" class="processing" src="/image/processing.gif">,
      <a href="javascript:void(0)" class="psevdo"
         onclick="return addExpiredAdUserReview(<c:out value='${flatAd.id}'/>, '<search:loginAndReviewUrl flatAdId='${flatAd.id}' reviewUrl="/ad/user/review/expiredAd.do"/>');">это объявление неактуально</a>
      <img id="processingExpiredAdUserRating<c:out value='${flatAd.id}'/>" class="processing" src="/image/processing.gif">
    </span>
  </p>
</search:userReview>